package com.dhl.fin.api.config;

import okhttp3.OkHttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
public class HttpClientConfig {

    @Bean
    public OkHttpClient configClient() {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .connectTimeout(5, TimeUnit.SECONDS) // 连接超时时间
                .readTimeout(3, TimeUnit.SECONDS) // 读取超时时间
                .writeTimeout(3, TimeUnit.SECONDS) // 写入超时时间
                .build();
        return client;
    }

}



